package com.dg11185.nearshop.net.response;

import org.json.JSONObject;

/**
 * 获取会员详情结果
 * 
 * @author wanliang527
 * @date 2014-4-29
 */
public class GetUserDetailResponse {
    public final static String SUCCESS = "SUCCESS";// 注册成功
    public final static String FAILE = "FAILE";// 调用失败
    public final static String ILLEGAL_PAR = "ILLEGAL_PAR";// 参数异常
    public final static String MEM_NOTFOUND = "MEM_NOTFOUND";// 会员不存在
    public final static String MEM_ILLEGALPWD = "MEM_ILLEGALPWD";// 密码不正确
    public final static String EXCEPTION = "EXCEPTION";// WS调用失败
    public final static String ILLEGAL_SIGN = "ILLEGAL_SIGN";// 签名无效

    public NetStatus status = NetStatus.EXCEPTION;
    public String userId = ""; // 用户userId
    public String customerName = "";// 真实姓名
    public String idCard = "";// 证件号
    public String sex = "";// 性别(0表示男;1表示女)
    public String job = "";// 工作类型(JOB类型参考辅助接口)
    public String birthday = "";// 生日

    public void parseJson(String response){
        try {
            JSONObject jsonObject = new JSONObject(response);
            status = NetStatus.getStatus(jsonObject.getString("status"));

            if (!jsonObject.isNull("member")) {
                JSONObject member = jsonObject.getJSONObject("member");
                userId = member.getString("userId");
                customerName = member.getString("customerName");
                idCard = member.getString("idCard");
                sex = member.getString("sex");
                job = member.getString("job");
                birthday = member.getString("birthday");
            }

        } catch (Exception e) {
        }
    }
}
